package com.config;

import org.springframework.core.convert.converter.Converter;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateConverter implements Converter<String, Date> {
    private String date="yyyy-MM-dd HH:mm:ss";

    @Override
    public Date convert(String arg0) {
        SimpleDateFormat sdf=new SimpleDateFormat(date);
        Date dt=null;

        try {
            dt= sdf.parse(arg0);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return dt;
    }
}
